//1.引入样式表
//公用样式 
require('../../assets/css/index.less');
require('../../assets/fonts/iconfont.css');
// weui
require("../../lib/weui/weui.css")
let weui = require("../../lib/weui/weui.js")
// 当前页面样式
require('./player.less')

//2.引入工具函数 utils
const dom = require('../../utils/dom');
const https = require('../../utils/https');
const local = require('../../utils/local');

// 3.当前页面的js
dom.ready(function () {
    // dom.tMenu("courseDetails");
    //加载底部菜单
    // dom.bMenu('sport');

    let localData = local.get('videoS');
    dom.getEle('video').src = 'http://fitness.h5.itsource.cn:3701' + localData[0].videoUrl;

    let flag = true;

    dom.addEvent('#playBtn', function () {
        if (flag) {
            dom.getEle('video').play();
            this.className='iconfont icon-stop';
        } else {
            dom.getEle('video').pause();
            this.className='iconfont icon-play';
        }

        flag=!flag;
    })

    let index = 0
    dom.addEvent('#rightBtn',function(){
        index++;
        if(index==localData.length){
            index=0;
        }
        dom.getEle('video').src='http://fitness.h5.itsource.cn:3701' + localData[index].videoUrl;
    })

    dom.addEvent('#leftBtn',function(){
        index--;
        if(index==-1){
            index=localData.length-1;
        }
        dom.getEle('video').src='http://fitness.h5.itsource.cn:3701' + localData[index].videoUrl;
    })

})


